#include <iostream>
#include <string>
#include <vector>
#include <stack>

using namespace std;

int main() {

    string str;
    getline(cin, str);

    int n = str.size();

    stack<string> st;

    for (int i = 1; i < n;)
    {
        string word = "";

        while (i < n && str[i] != ' ' && str[i] != '.')
        {
            if (str[i - 1] != ' ')
                word += str[i - 1];
            i++;
        }

        if (str[i] == ' ')
        {
            if (str[i - 1] != ' ')
                word += str[i - 1];
            st.push(word);
            i++;
        }
        else if (str[i] == '.')
        {
            if (str[i - 1] != ' ')
                word += str[i - 1];
            word += '.';
            st.push(word);
            break;
        }
    }

    cout << st.top() << " ";
    st.pop();
    while (!st.empty())
    {
        string res_str = st.top();

        cout << res_str << " ";

        st.pop();
    }

    return 0;
}